package com.xjd.edu.common.exception;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
public class UserException extends BizException {

    private final ExceptionCode exceptionCode;

    public UserException(ExceptionCode exceptionCode) {
        super();
        this.code = exceptionCode.getCode();
        this.message = exceptionCode.getMsg();
        this.exceptionCode = exceptionCode;
    }

    public UserException(ExceptionCode exceptionCode, String message) {
        super();
        this.code = exceptionCode.getCode();
        this.message = message;
        this.exceptionCode = exceptionCode;
    }

    @AllArgsConstructor
    @Getter
    public enum ExceptionCode {
        USER_NOT_EXIST_EXCEPTION(20001, "用户不存在"),
        USER_BANNED_EXCEPTION(20000, "用户被封禁"),
        USER_MISMATCH_EXCEPTION(20002, "用户不匹配"),
        IllEGAL_MOBILE_EXCEPTION(20003, "手机号参数为空或不合法"),
        USER_INFO_NULL_EXCEPTION(20007, "未查询到用户信息"),
        USERNAME_DUMPLICATE_EXCEPTION(20008, "用户名重复"),
        NAME_DUMPLICATE_EXCEPTION(20009, "姓名重复"),
        VERIFICATION_CODE_WRONG(20012, "验证码不正确"),
        WX_PHONE_NOT_EXIST_EXCEPTION(21002, "未获取用户手机号"),
        USER_SETTING_NOT_SUPPORT(21508, "功能正在开发中"),
        ;

        private int code;
        private String msg;
    }


}
